import Vue from 'vue'
import axios from 'axios'
Vue.prototype.$axios = axios    //全局注册
import Cookies from 'js-cookie'
import Viser from 'viser-vue'
import map from './utils/map.js'
import './utils/directives.js'
import mapnew from './utils/mapnew.js'
import './utils/Leaflet.AnimatedMarker.js'
import 'leaflet/dist/leaflet.css'
import './utils/MovingMarker.js'
import './utils/popupPlus'
import $ from 'jquery'
import layer from 'vue-layer'
import 'vue-layer/lib/vue-layer.css'
import 'leaflet-easybutton'
import 'leaflet-easybutton/src/easy-button.css'
import {CanvasMarkerLayer} from "@panzhiyue/leaflet-canvasmarker"
Vue.prototype.$map=map
Vue.prototype.$mapnew=mapnew
Vue.prototype.$layer = layer(Vue);
Vue.use(Viser)

window.jQuery = $
window.$ = $
import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'



import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import socketIO from './socketIO'
import eventBus from './bus/bus'



import * as filters from './filters' // global filters


Vue.use(socketIO)
// mock api in github pages site build

Vue.use(Element)

// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
if(process.env.NODE_ENV==='production')
{
  if(window){
    window.console.log=function(){};
  }
}
Vue.config.productionTip = false

Vue.prototype.$bus = eventBus


axios.get('./configJSON.json') // 假设JSON文件名为configJSON.json
.then(response => {
  store.dispatch('user/setConfig', response.data.data).then(() => {
    new Vue({
      el: '#app',
      router,
      store,
      render: h => h(App)
    })
  })
})
.catch(error => {
  console.error('Error fetching configJson: ', error);
});

